package com.hnnou.freshmenappserver.dao;

import com.hnnou.freshmenappserver.bean.Function;
import com.hnnou.freshmenappserver.bean.News;
import com.hnnou.freshmenappserver.bean.News;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface NewsDao {
    @Select("select * from t_news")
    List<News> findAll();
    @Delete("delete from t_news where id=#{id}")
    int deleteById(int id);
    @Update("update t_news set title=#{title} ,content=#{content} ,date=#{date}" +
            " where id=#{id}")
    int update(News news);
    @Insert("insert into t_news(title,content,date)"+
            " values(#{title},#{content},#{date})")
    int insert(News news);

    @Select("select * from t_news where id=#{id}")
    News selectById(int id);

    @Select("select * from t_news where id=#{id}")
    List<News> findById(Integer id);

}
